//
// Created by xili on 2024/9/21 11:20.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    vector <vector<int>> generate(int numRows) {
        vector <vector<int>> ans(numRows);
        for (int i = 0; i < numRows; i++) {
            ans[i].resize(i + 1, 1);
            for (int j = 1; j < i; j++) {
                // 左上方的数 + 正上方的数
                ans[i][j] = ans[i - 1][j - 1] + ans[i - 1][j];
            }
        }
        return ans;
    }
};